package gemini.castor.ui.client.page.content.customer.customerlist.list;

import gemini.basic.model.Customer;
import gemini.castor.ui.client.constants.I18nConstants;
import gemini.castor.ui.client.page.content.customer.customerlist.widget.CustomerTableWidget;

import java.util.List;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiTemplate;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.Widget;

public class CustomerListView extends Composite implements
		CustomerListPresenter.Display {

	@UiTemplate("CustomerListView.ui.xml")
	interface MyUiBinder extends UiBinder<Panel, CustomerListView> {
	}

	private static final MyUiBinder binder = GWT.create(MyUiBinder.class);
	private I18nConstants constants;
	
	public CustomerListView() {
		initWidget(binder.createAndBindUi(this));
		constants = GWT.create(I18nConstants.class);
	}
	
	@UiField
	CustomerTableWidget lvwCustomerList;
	
	@Override
	public CustomerTableWidget getCustomerTableWidget(){
		return lvwCustomerList;
	}

	@UiField
	HTML htmTitle;
	
	@UiField
	HTML htmInformation;
	
	@Override
	public Widget asWidget() {
		return this;
	}

	@Override
	public void initCustom() {
		htmTitle.setHTML("<h1>"+ constants.nviEvents()+"</h1>");
		htmInformation.setHTML(constants.htmEventsInfo());
	}
	
	@Override
	public void showCustomers(List<Customer> customers){
		lvwCustomerList.loadData(customers);
	}

	@Override
	public void loadData() {
		// TODO Auto-generated method stub
	}
	
}
